import "../index";
import config from "@/config/index.js";
import request from "../index.js";

//初始化
export const initAPI = (data) => {
  return request.post(`${config.baseUrl}/webapi/init`, {
    data: data,
  });
};

//创建助记词
export const createRecoveryPhraseAPI = (data) => {
  return request.post(`${config.baseUrl}/webapi/wallet/createRecoveryPhrase`, {
    data: data,
  });
};

// 创建钱包
export const createWalletAPI = (data) => {
  return request.post(`${config.baseUrl}/webapi/wallet/createWallet`, {
    data: data,
  });
};

//导入钱包
export const importRecoveryPhraseAPI = (data) => {
  return request.post(`${config.baseUrl}/webapi/wallet/importRecoveryPhrase`, {
    data: data,
  });
};

//钱包首页
export const getWalletListAPI = (data) => {
  return request.get(`${config.baseUrl}/webapi/wallet/getWalletList`, {
    data: data,
  });
};

//聊天首页
export const getMyAddressAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/user/getMyAddress`, {
    data: data,
  });
};

//密码校验
export const checkPasswordAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/user/checkPassword`, {
    data: data,
  });
};

//最近聊天
export const latelyChatAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/user/latelyChat`, {
    data: data,
  });
};

//搜索好友
export const searchFriendAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/user/searchFriend`, {
    data: data,
  });
};

//添加好友
export const addFriendAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/user/addFriend`, {
    data: data,
  });
};

//删除好友
export const delFriendAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/user/delFriend`, {
    data: data,
  });
};

//好友列表（已排序）
export const friendListAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/user/friendList`, {
    data: data,
  });
};

//好友列表（未排序）
export const friendArrAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/user/friendArr`, {
    data: data,
  });
};

//获取添加好友信息
export const getNewFriendAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/user/getNewFriend`, {
    data: data,
  });
};

//添加好友处理
export const handleFriendAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/user/handleFriend`, {
    data: data,
  });
};

//创建群聊
export const crateGroupAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/group/crateGroup`, {
    data: data,
  });
};

//发布动态
export const addDynamicAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/userDynamic/addDynamic`, {
    data: data,
  });
};

//获取动态
export const getDynamicAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/userDynamic/getDynamic`, {
    data: data,
  });
};
//获取我的动态
export const getMyDynamicAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/userDynamic/getMyDynamic`, {
    data: data,
  });
};
//点赞动态
export const setDynamicLikeAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/userDynamic/setDynamicLike`, {
    data: data,
  });
};
//动态详情
export const getDynamicByIdAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/userDynamic/getDynamicById`, {
    data: data,
  });
};
//发布动态评论
export const sendCommentsAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/userDynamic/sendComments`, {
    data: data,
  });
};

//删除评论
export const delDynamicAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/userDynamic/delDynamic`, {
    data: data,
  });
};

//我的个人资料卡
export const getOneselfInfoAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/userInfo/getOneselfInfo`, {
    data: data,
  });
};

//钱包列表
export const getAddressListAPI = () => {
  return request.get(`${config.baseUrl}/webapi/wallet/getAddressList`);
};

//群聊列表
export const getGroupAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/group/getGroup`, {
    data: data,
  });
};

//群聊资料
export const getGroupInfoAPI = (data) => {
  return request.get(`${config.baseUrl}/chatapi/group/getGroupInfo`, {
    data: data,
  });
};

// 解散群聊
export const delGroupAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/group/delGroup`, {
    data: data,
  });
};
//退出群聊
export const exitGroupAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/group/exitGroup`, {
    data: data,
  });
};

//踢出群聊
export const delMemberAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/group/delMember`, {
    data: data,
  });
};

//更新群聊资料
export const updateGroupAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/group/updateGroup`, {
    data: data,
  });
};

//文件上传
export const uploadPhotoAPI = (data) => {
  return request.post(`${config.baseUrl}/chatapi/user/uploadPhoto`, {
    data: data,
  });
};
